package com.yuyou.fn.educational.service.impl;

import com.github.wens.framework.service.impl.SuperServiceImpl;
import com.github.wens.mybatisplus.examples.Example;
import com.yuyou.fn.educational.entity.ClassQuestionScore;
import com.yuyou.fn.educational.mapper.ClassQuestionScoreMapper;
import com.yuyou.fn.educational.service.IClassQuestionScoreService;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 *
 * ClassQuestionScore 表数据服务层接口实现类
 *
 */
@Service
public class ClassQuestionScoreServiceImpl extends SuperServiceImpl<ClassQuestionScoreMapper, ClassQuestionScore,Long> implements IClassQuestionScoreService {

    @Override
    public List<ClassQuestionScore> findListByRecordId(Long classQuestionnaireRecordId) {
        Example<ClassQuestionScore> example=ClassQuestionScore.createExample();
        example.createCriteria().andEqualTo("classQuestionnaireRecordId",classQuestionnaireRecordId);
        example.orderBy("questionnNo");
        return this.findListByExample(example);
    }

    @Override
    public List<ClassQuestionScore> findListByRecordIds(List<Long> classQuestionnaireRecordIds) {
        if (classQuestionnaireRecordIds==null || classQuestionnaireRecordIds.size()<0){
            return Collections.EMPTY_LIST;
        }
        Example<ClassQuestionScore> example=ClassQuestionScore.createExample();
        example.createCriteria().andIn("classQuestionnaireRecordId",classQuestionnaireRecordIds);
        example.orderBy("classQuestionnaireRecordId").orderBy("questionnNo");
        return this.findListByExample(example);
    }
}